package com.whj.homework_step1_model_4.service;

import com.whj.homework_step1_model_4.pojo.Article;
import com.whj.homework_step1_model_4.regesitory.ArticleRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {
    @Autowired
    private ArticleRegister articleRegister;
    public Page<Article> getAll(Integer currentPage,Integer size){
        Pageable pageable = PageRequest.of(currentPage,size);
        return this.articleRegister.findAll(pageable);
    }
}
